package com.example.basic.web.service.log.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.basic.base.impl.BaseEntityServiceImpl;
import com.example.basic.web.mapper.log.OperLogMapper;
import com.example.basic.web.model.log.OperLog;
import com.example.basic.web.response.OperLogResponse;
import com.example.basic.web.service.log.OperLogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * <p>
 * 系统操作日志表 服务实现类
 * </p>
 *
 * @author sunyp
 * @since 2023-09-06
 */
@Service
@Transactional
public class OperLogServiceImpl extends BaseEntityServiceImpl<OperLogMapper, OperLog> implements OperLogService {

    @Resource
    private OperLogMapper operLogMapper;

    @Override
    public int add(OperLog operLog){
        return super.insert(operLog);
    }

    @Override
    public int modify(OperLog operLog){
        return super.updateById(operLog);
    }

    @Override
    public OperLog detail(String id){
        return super.selectById(id);
    }

    @Override
    public IPage<OperLog> page(Page<OperLog> page){
        return super.selectPage(page);
    }

    /**
     * 日志列表
     *
     * @param queryPage  分页
     * @param content    日志内容
     * @param operPerson 操作人
     * @param operType   操作类型
     * @param beginTime  开始时间
     * @param endTime    结束时间
     * @param logType 日志类型
     * @return
     */
    @Override
    public IPage<OperLogResponse> queryList(Page<OperLogResponse> queryPage, String content, String operPerson, String operType, String beginTime, String endTime, String logType) {
        return this.mapper.queryList(queryPage,content,operPerson,operType,beginTime,endTime,logType);
    }
}